home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr09 / fgrtodb.zip / PAF1.AWK < prev    next >
Text File  |  1993-06-03  |  2KB  |  49 lines

  1. # Extract children data from FGRs
  2. # This awk file will convert a family group record (that has been 
  3. # pre-processed with paf1.sed (placing field separators with ":")
  4. # to delimited format.  Note:  Still needs to be processed by
  5. # cleanup.sed
  6. # S Valentine, 7.7.89
  7.  
  8. BEGIN {  # set field separator to ":" vice the default space
  9.     FS =":" }
  10. $1 ~ /FAMILY/ {  # get the mrin for the individual
  11.     mrin = $2+0 }
  12. $1 ~ /HUSBAND/ { # get the husband's name, rin
  13.     husband = $2
  14.     hrin = $3+0 }
  15. $1 ~ /WIFE/ { # get the Wife's name, rin 
  16.     $2 == "" ? wife = "UNKNOWN" : wife = $2
  17.     wrin = $3+0 }
  18. $2 ~ /NAME/ { 
  19.     child = $3 
  20.     child_rin = $4+0 
  21.     $6 != "" ? child_spouse = "DELETE" : child_spouse = "" 
  22.     # note what I did above.  If the child's spouse is listed,
  23.     # replace the name with DELETE.  Cleanup.sed will remove
  24.     # those lines with DELETE
  25.     # if you wish the name of the spouse, use the following line
  26.     # child_spouse = $6  # remove the "#" remark symbol
  27.     spouse_rin = $7+0 
  28.     child_mrin = $9+0 } 
  29. $1 ~ /BORN/ { # get the child's birthdate and place of birth
  30.     birthdate = $2
  31.     birthplace = $4 }
  32. $2 ~ /CHR/ { # get the child's sex
  33.     sex = $1 }
  34. $1 ~ /MARR/ { # get the child's wedding date and place of wedding
  35.     marrdate = $2
  36.     marrplace = $4 }
  37. $1 ~ /DIED/ { # print the record
  38.     deathdate = $2
  39.     deathplace = $4 
  40.     printf("\"%s\",\"%s\",%d,\"%s\",\"%s\",\"%s\",",
  41.         child, sex, child_rin, birthdate, birthplace, child_spouse)
  42.     printf("%d,\"\",\"\",%d,\"%s\",\"%s\",\"%s\",%d,\"%s\"",
  43.         spouse_rin, child_mrin, deathdate, deathplace, husband, hrin, wife)
  44.     printf(",%d,%d", 
  45.         wrin, mrin) 
  46.     printf ("\n") }
  47.  
  48.  
  49.